using TestCases.CompareAssert.Core.Builders;
using TestCases.CompareAssert.Core.Interfaces;

namespace TestCases.CompareAssert.Core.Helpers
{
    public class ResultSettings: IResultSettings
    {
        private readonly CompareStatus _status;
        private readonly string _message;
        private readonly object _args;

        public ResultSettings(CompareStatus status, string message, object args) : this(status, message)
        {
            _args = args;
        }
        
        public ResultSettings(CompareStatus status, string message)
        {
            _status = status;            
            _message = message;
        }

        public ResultSettings(CompareStatus status) : this(status, ResultBuilder.GetDefaultTemplate(status))
        {
        }
        
        public ResultSettings(bool value, string message, object args) : this(value, message)
        {
            _args = args;
        }
        
        public ResultSettings(bool value, string message)
        {
            _status = StatusUtils.FromBool(value);
            _message = message;
        }

        public ResultSettings(bool value)
        {            
            _status = StatusUtils.FromBool(value);
            _message = ResultBuilder.GetDefaultTemplate(_status);
        }
        
        public ResultSettings(ICompareResult fromResult) : this(fromResult.Status, fromResult.Message)
        {
        }
                
        public CompareStatus GetStatus()
        {
            return _status;
        }

        public string GetMessage()
        {
            return _message;
        }

        public object GetArgs()
        {
            return _args;
        }
    }
}